/*
 * @Author: XieQiu 雪球
 * @Date: 2021-05-31 10:47:33
 * @LastEditTime: 2021-05-31 11:22:33
 * @LastEditors: XieQiu 雪球
 * @Description: 部门管理接口
 */
import xjaxios from "@/api/axios";
export default {
  /**
   * @description: 获取部门列表 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   * @param {Object} entity {componyId: 1} *
   * @param {String} order 排序方式 ASC DESC 默认ASC
   * @param {String} sort 自定义排序方式 'createTime'
   * @return {Array}
   */
  getDepartmentList(param) {
    return xjaxios.post("v3/organization/department/queryPageByCondition", param);
  },

  /**
   * @description: 新增部门信息
   * @param {Object} formData *
   * @return {Object}
   */
  addDepartmentInfo(formData) {
    formData.organizationNo = sessionStorage.organizationNo;
    return xjaxios.post("v3/organization/department/add", formData);
  },
  /**
   * @description: 编辑部门信息
   * @param {Object} formData *
   * @return {Object}
   */
  editDepartmentInfo(formData) {
    return xjaxios.post("v3/organization/department/edit", formData);
  },

  // /**
  //  * @description: 批量删除数据
  //  * @param {Array} list *
  //  * @return {Object}
  //  */
  delDepartmentInfo(list) {
    return xjaxios.get(`v3/organization/department/delListByDepartmentNo?noList=${list}`);
  },
  // /**
  //  * @description: 单个删除数据
  //  * @param {Array} list *
  //  * @return {Object}
  //  */
  delInfo(list) {
    return xjaxios.get(`v3/organization/department/delByDepartmentNo?no=${list}`);
  },
  // /**
  //  * @description: 条件查询所有部门
  //  * @param null *
  //  * @return {Object}
  //  */
  getDepartmentListByCondition() {
    return xjaxios.post("v3/organization/department/queryByCondition", {
      organizationNo: sessionStorage.organizationNo
    });
  },

  /**
   * @description: 主键查询部门信息
   * @param {String} unitId*
   * @return {Object}
   */
  queryDepartmentById() {
    let organizationNo = sessionStorage.organizationNo
    return xjaxios.get(`v3/organization/department/queryTreeList/${organizationNo}`);
  }
};
